<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>position学习，层叠</title>
</head>
<body style="width:980px;height:5000px;margin:0 auto">
    <!--position：fixed表示固定位置，位置是后面参数指定-->
    <div onclick="GoTop();" style="width:42px;height:42px;background-color:black;color:white;position:fixed;bottom:20px;right:20px;">返回顶部</div>
    <div style="height:5000px;background-color:#dddddd;">aaaaaa</div>

    <script>
        function GoTop(){
            document.body.scrollTop = 0;
        }
    </script>
</body>
</html>